<script src="__PUBLIC__/js/jquery-1.8.3.js"></script>
<script src="__PUBLIC__/js/global.js"></script>
<script src="__STATIC__/js/jquery.artalert.js"></script>
<!--最顶部-->
<include file="Public/siteTopbar" />

<link rel="stylesheet" type="text/css" href="__STATIC__/css/homehtmleaf-demo.css">
<header>
    <div class="layout headertop" <if condition="$Think.cookie.hidetopstatus neq 'hide'">style="display:none;"</if>>
    	
		<script>
		// ajax 删除购物车的商品
$(function() {
	$(".navigation_top").click(function(){

		ajax_hide_top();
	});		
	$(".closeheader").click(function(){
		ajax_hide_top();
	});		
});


function ajax_hide_top()
{
			$.ajax({
				type : "POST",
				url:"{:U('Home/Index/ajaxHideTop')}",//+tab,
				data:"", // 
				dataType:'json',		
				success: function(data){
				   if(data.status == 1)	
				   {	
				   		//国旗旁logo
				   		$(".sitetopbarlogo").css("display","block");
						$(".navigation").addClass("navh56");
						
				   		$(".navigation_top").css("display","block");
						$(".headertop").slideUp(500);
					}
					else if(data.status == 2)	
					{
						//隐藏头部
				   		//国旗旁logo
				   		$(".sitetopbarlogo").css("display","none");
						$(".navigation").removeClass("navh56");
						
				   		$(".navigation_top").css("display","none");
						$(".headertop").slideDown(500);
					}
				}
			});
			//$.artTip('隐藏成功', 800)
		
	
	
}
		</script>
    <!--logo开始-->
        <div class="logo"><a href="/" ><img src="__STATIC__/images/logo.jpg"  /></a></div>
    <!--logo结束-->
    
    <div class="navigation <if condition="$Think.cookie.hidetopstatus neq 'hide'"> navh56</if>">
    	
    	
        	<!--全部商品-开始-->
        	<div class="allgoods">
            	<div class="goods_num"><h2>{$Think.lang.allproducts}</h2></div>
            	<div class="list list_bg" >
                   	<div class="layout">
                    	<ul id="list_menu">
                       <foreach name="goods_category_tree" key="k" item='v'>
                           <if condition="$v[level] eq 1">                       
                              
                                  <span><a href="{:U('Home/Goods/goodsList',array('id'=>$v[id]))}">{$v[$name]}</a></span>
									
									<if condition="$v[tmenu]" >
                                            
                                           <foreach name="v[tmenu]" item="v2" key="k2" >
                                               <if condition="$v2[parent_id] eq $v[id]">
                                                    
                                                      <li><span><a href="{:U('Home/Goods/goodsList',array('id'=>$v2[id]))}">{$v2[$name]}</a></span>
														
                                                       
                                                           <foreach name="v2[sub_menu]" item="v3" key="k3" >
	                                                         <if condition="$v3[parent_id] eq $v2[id]">                                                           
	                                                            <a href="{:U('Home/Goods/goodsList',array('id'=>$v3[id]))}">{$v3[$name]}</a>
                                                              </if>
                                                           </foreach>
                                                      </li>
                                                   
                                                </if>
                                           </foreach>
                                           
									</if>
									
                              </li>
                            </if>    
    				 </foreach>	
                     <div style="clear:both;"></div>
                     </ul>
                	</div>
                </div>
            <!--全部商品-结束-->
			

			
            
        </div><div class="ongoods">
            	<ul class="navlist">
            		<!--<li class="page"><a href="/" ><span>1首頁</span></a></li>-->
					
		
			
                    <tpshop sql="SELECT * FROM `__PREFIX__brand` where is_hot = 1 ORDER BY `id` asc" key="k" item='v'>
					
					
            			<li class="page"><a href="{:U('Home/Goods/goodslist',array('brand_id'=>$v[id]))}" <if condition="$brand_id eq $v[id] ">class="active"</if> ><span>{$v[$name]}</span></a></li>
					</tpshop> 
            	</ul>
            </div>
    </div>
        
        <ul id="header_rn">
        	<li class="topitem"><a href=""><img src="__STATIC__/images/h_n_lang.jpg" style="margin-right:4px;"  />{$Think.lang.chooselanguage}<img src="__STATIC__/images/h_n_lang_arrow.jpg" style="margin-left:5px;"  /></a>
            			<div class="subNav LangDiv" style=" width:80px;">
                            <ul>
                                <li><a href="?l=zh-cn">{$Think.lang.simplifiedChinese}</a></li>
                                <li><a href="?l=zh-hk">{$Think.lang.chineseTraditional}</a></li>
                                <li><a href="?l=zh-jp">{$Think.lang.japanese}</a></li>
                            </ul>
                        </div>
            </li>
        	<li class="topitem"><img src="__STATIC__/images/h_n_phone.jpg"  />
            	<div class="subNav phonesec" >
					<img src="__STATIC__/images/ewm.jpg" width="80"  />
					<div class="subnav_tips">{$Think.lang.phonesys}</div>
					<div class="clear-both"></div>
                </div>
            </li>
        	<li class="topitem">
            
            <div class="ri-mall">
            <div class="my-mall" id="header_cart_list">
                <!---购物车-开始 -->
                    <div class="micart">
                        <div class="le les">
                            <a href="{:U('Home/Cart/cart')}" ><img src="__STATIC__/images/h_n_cart.jpg" /></a>                       
                        </div>
                        
                        <div class="ri ris">
                           <if condition="count($cartList) eq 0">
                                <div class="micart-about">
                                    <span class="micart-xg">{$Think.lang.shoppingtrolleyisnull}</span>
                                </div>
                            </if>
                            <div class="commod">
                            <ul>
                            <foreach name="cartList" item="v"  key="k">
                                <li class="goods">
                                    <div>
                                        <div class="p-img">
                                            <a href="">
                                                <img src="{$v.goods_id|goods_thum_images=428,428}" alt="">
                                            </a>
                                         </div>
                                         <div class="p-name">
                                            <a href="">
                                                <span class="p-slogan">{$v[goods_name]}</span>
                                                <span class="p-promotions hide"></span>
                                            </a>
                                         </div>
                                         <div class="p-status">
                                            <div class="p-price">
                                                <b>¥&nbsp;{$v[goods_price]}</b>
                                                <em>x</em>
                                                <span>{$v[goods_num]}</span>
                                            </div>
                                            <div class="p-tags"></div>
                                         </div>
                                         <!--
                                         <a href="" class="icon-minicart-del" title="删除">删除</a>
                                           -->
                                    </div>
                                </li>
                             </foreach>   							
                            </ul>
                            </div>
                            <div class="settle">
                                <p>{$Think.lang.gong}<em>{$cart_total_price[anum]}</em>{$Think.lang.Totalamountofgoods}<b>¥&nbsp;{$cart_total_price[total_fee]}</b></p>
                                <a class="js-button" href="{:U('Home/Cart/cart')}">{$Think.lang.shoppingcartsettlement}</a>
                            </div>
                     </div>
                </div>
                <!---购物车-结束 -->
                
        </div>
       
    </div></li>
        	<li class="topitem"><a href="{:U('Home/User/goods_collect')}" ><img src="__STATIC__/images/h_n_favitore.jpg"  /></a></li>
            
        	<li class="topitem islogin"><a href="{:U('Home/User/index')}"><img src="__STATIC__/images/h_n_my.jpg"  /></a></li>
        	<li class="topitem nologin"><a href="{:U('Home/User/login')}"><img src="__STATIC__/images/h_n_my.jpg"  /></a></li>
        	<li class="topitem nologin"><a href="{:U('Home/user/reg')}"><img src="__STATIC__/images/h_n_register.jpg"  /></a></li>
        	<li class="topitem">
            	<div class="searchBar-form">
                    <form name="sourch_form" id="sourch_form" method="post" action="{:U("/Home/Goods/search")}">
                        <input type="button" class="button" value="" onclick="if($.trim($('#q').val()) != '') $('#sourch_form').submit();"/>
                        <input type="text" class="text" name="q" id="q" placeholder="{$Think.lang.searchtips}" value="<?php echo I('q'); ?>"  />
                    </form>
                </div>
           	</li>
        </ul>
        
        
</header>
   <!-- 导航-开始-->
   
   
<script>
$(function(){
    var active_li = '{$active}';
    if(active_li){
        $('li').remove('curr-res');
        $('#'+active_li).addClass('curr-res');
    }
   	
    var uname= getCookie('uname');
    if(uname == ''){
    	$('.islogin').remove();
    	$('.nologin').show();
    }else{
    	$('.nologin').remove();
    	$('.islogin').show();
    	$('.userinfo').html(decodeURIComponent(uname));
    }
    get_cart_num();
})



function get_cart_num(){
	  var cart_cn = getCookie('cn');
	  if(cart_cn == ''){
		$.ajax({
			type : "GET",
			url:"/index.php?m=Home&c=Cart&a=header_cart_list",//+tab,
			success: function(data){								 
				cart_cn = getCookie('cn');		
				$('#cart_quantity').html(cart_cn);
			}
		});	
	  }
	  $('#cart_quantity').html(cart_cn);
}
/**
* 鼠标移动端到头部购物车上面 就ajax 加载
*/
// 鼠标是否移动到了上方
var header_cart_list_over = 0; 
$("#header_cart_list > .micart > .les").hover(function(){	 
       if(header_cart_list_over == 1) 
			return false;	
        header_cart_list_over = 1; 
		$.ajax({
			type : "GET",
			url:"/index.php?m=Home&c=Cart&a=header_cart_list",//+tab,
			success: function(data){								 
			 	$("#header_cart_list > .micart > .ris").html(data);	
			 	get_cart_num();
			}
		});			
}).mouseout(function(){
	
	 (typeof(t) == "undefined") || clearTimeout(t); 	 
	 t = setTimeout(function () { 
			header_cart_list_over = 0; /// 标识鼠标已经离开
		}, 1000);		
});
</script>